

package com.jingdun.sport.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jingdun.sport.bean.model.User;
import com.jingdun.sport.dao.UserMapper;
import com.jingdun.sport.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.CachePut;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.util.Map;

@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {

    @Autowired
    private UserMapper userMapper;


    @Override
//    @Cacheable(cacheNames="user",key="#userId")
    public User getUserByUserId(String userId) {
        return userMapper.selectById(userId);
    }
    
    @Override
//    @CacheEvict(cacheNames="user",key="#user.userId")
    public boolean updateById(User user) {
        return super.updateById(user);
    }

    @Override
    public User getUserDetail(Map<String, Object> m) {
        return userMapper.getUserDetail(m);
    }

    @Override
//    @CachePut(cacheNames="user",key="#userId")
    public User updateUser(User user){
        userMapper.updateUser(user);
        return user;
    }

    @Override
    public Map getUserUnWithdrawalSum() {
        return userMapper.getUserUnWithdrawalSum();
    }

}
